package com.pie4cloud.pie.job.executor.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.pie4cloud.pie.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.*;

@Data
@Entity
@Table(name = "T_DATA_PLAYBILL_MONITOR")
public class PlayBillMonitorEntity extends BaseEntity {

	@Id
	@TableId(value = "id", type = IdType.ASSIGN_ID)
	@GenericGenerator(name="snowflakeId", strategy="com.pie4cloud.pie.jpa.id.GenerateSnowflakeId")
	@GeneratedValue(generator="snowflakeId")
	@ApiModelProperty(value="id")
	private Long id;

	@Column(name = "database_id", length = 50)
	private String databaseId;

	@Column(name = "table_name", length = 50)
	private String tableName;
	//资料四级编码
	@Column(name = "d_data_id", length = 50)
	private String ddataId;
	//资料存储编码
	@Column(name = "d_data_class_id", length = 50)
	private String ddataClassId;

	@Column(name = "play_bill_id", length = 50)
	private Long playBillId;

	//资料名称
	@Column(name = "data_name", length = 50)
	private String dataName;
    //资料时次
	@Column(name = "time_level", length = 50)
	private Date timeLevel;

	//收集应收
	@Column(name = "collect_should_num", length = 50)
	private Integer collectShouldNum=0;
	//收集实收
	@Column(name = "collect_real_num", length = 50)
	private Integer collectRealNum=0;
	//收集晚到
	@Column(name = "collect_late_num", length = 50)
	private Integer collectLateNum=0;

	//解码应收
	@Column(name = "decode_should_num", length = 50)
	private Integer decodeShouldNum=0;
	//解码实收
	@Column(name = "decode_real_num", length = 50)
	private Integer decodeRealNum=0;
	//解码晚到
	@Column(name = "decode_late_num", length = 50)
	private Integer decodeLateNum=0;


	@OneToMany(targetEntity=DispenseMonitorEntity.class,cascade = CascadeType.ALL,fetch = FetchType.EAGER)
	@JoinColumn(name="play_bill_monitor_id",referencedColumnName="id")
	private Set<DispenseMonitorEntity> dispenseMonitors = new HashSet<>();


}
